﻿using System;
using System.Collections.Generic;

namespace NodeJS
{
    using NodeJS.os;
    /// <summary>
    /// Provides a few basic operating-system related utility functions.
    /// </summary>
    public abstract class OS
    {
        /// <summary>
        /// Returns the operating system's default directory for temp files.
        /// </summary>
        /// <returns></returns>
        public abstract string Tmpdir();

        /// <summary>
        /// Returns the endianness of the CPU.
        /// </summary>
        /// <returns>Possible values are "BE" or "LE".</returns>
        public abstract string Endianness();

        /// <summary>
        /// Returns the hostname of the operating system.
        /// </summary>
        /// <returns></returns>
        public abstract string Hostname();

        /// <summary>
        /// Returns the operating system name.
        /// </summary>
        /// <returns></returns>
        public abstract string Type();

        /// <summary>
        /// Returns the operating system platform.
        /// </summary>
        /// <returns></returns>
        public abstract string Platform();

        /// <summary>
        /// Returns the operating system CPU architecture.
        /// </summary>
        /// <returns></returns>
        public abstract string Arch();

        /// <summary>
        /// Returns the operating system release.
        /// </summary>
        /// <returns></returns>
        public abstract string Release();

        /// <summary>
        /// Returns the system uptime in seconds.
        /// </summary>
        /// <returns></returns>
        public abstract long Uptime();

        /// <summary>
        /// Returns an array containing the 1, 5, and 15 minute load averages.
        /// The load average is a measure of system activity, calculated by the operating system and expressed as a fractional number. As a rule of thumb, the load average should ideally be less than the number of logical CPUs in the system.
        /// The load average is a very UNIX-y concept; there is no real equivalent on Windows platforms. That is why this function always returns [0, 0, 0] on Windows.
        /// </summary>
        /// <returns></returns>
        public abstract int[] Loadavg();

        /// <summary>
        /// Returns the total amount of system memory in bytes.
        /// </summary>
        /// <returns></returns>
        public abstract long Totalmem();

        /// <summary>
        /// Returns the amount of free system memory in bytes.
        /// </summary>
        /// <returns></returns>
        public abstract long Freemem();

        /// <summary>
        /// Returns an array of objects containing information about each CPU/core installed: model, speed (in MHz), and times (an object containing the number of milliseconds the CPU/core spent in: user, nice, sys, idle, and irq).
        /// </summary>
        /// <returns></returns>
        [ImportMember("cpus")]
        public abstract CpuInfo[] CPUs();

        /// <summary>
        /// Get a list of network interfaces.
        /// </summary>
        /// <returns></returns>
        public abstract Dictionary<string, NetworkInterface[]> NetworkInterfaces();


        /// <summary>
        /// A constant defining the appropriate End-of-line marker for the operating system.
        /// </summary>
        [ImportMember("EOL")]
        public const string EOL = "";
    }
}
